package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	counts := make(map[string]int)
	inputs := bufio.NewScanner(os.Stdin)
	for inputs.Scan() {
		if inputs.Text() == "exit" {
			break
		}
		counts[inputs.Text()]++
	}
	for msg, line := range counts {
		if line > 1 {
			fmt.Printf("%d\t%s\n", line, msg)
		}
	}
}
